package com.dyz.leetcode._13_binaryTree;

import com.dyz.leetcode.TreeNode;

public class _222_countNodes {
    //DFS
    public int countNodes(TreeNode root) {
        if(root==null){return 0;}
        int left = countNodes(root.left);
        int right = countNodes(root.right);
        return left+right+1;
    }
}
